]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Do not use Cancellable.reset()
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 16 Feb 2026 20:58:25 +0000 (21:58 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 17 Feb 2026 14:00:14 +0000 (14:00 +0000)
Cancellable reset API is deprecated for long time and it's quite broken.
In fact if a search provider receives a cancelled event may end up
checking if the cancellable has been cancelled, but this may not be true
anymore after a reset.

Use instead new cancellable instances so that once one is used we can
consider the previous one completed and we can forget about it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4080>

js/ui/search.js

index 99b8725da6d699c4d6214b107f09a13c4de1cdf0..7f72a87d25373134e85e8826a4a97f7fa43115a6 100644 (file)
@@ -226,7 +226,7 @@ const SearchResultsBase = GObject.registerClass({
             return;
 
         this._cancellable.cancel();
-        this._cancellable.reset();
+        this._cancellable = new Gio.Cancellable();
 
         const metas = await this.provider.getResultMetas(metasNeeded, this._cancellable);
 
@@ -742,7 +742,7 @@ export const SearchResultsView = GObject.registerClass({
         this._startingSearch = true;
 
         this._cancellable.cancel();
-        this._cancellable.reset();
+        this._cancellable = new Gio.Cancellable();
 
         if (terms.length === 0) {
             this._reset();